package test5;

public class MyThread2 extends Thread{
    @Override
    public void run() {
        int sum=0;
        for (int i = 1; i <= 1000; i++) {
            sum+=i;
        }
        System.out.println(Thread.currentThread().getName()+"线程计算1--1000的累加和，结果："+sum);
    }
}
